-
Notifications
You must be signed in to change notification settings - Fork 0
fix(query-core, vue-query): fix type inference in setQueryData
when used in functions with explicit return types
#1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
View your CI Pipeline Execution ↗ for commit 7c34847.
☁️ Nx Cloud last updated this comment at |
The CI test failure seems unrelated to the changes in this PR. My changes only affect TypeScript type definitions and a type test, with no runtime behavior modifications. The failure appears to be in an unrelated test. |
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Warning Rate limit exceeded@visz11 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 20 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses an important type inference issue in setQueryData
when used within functions with explicit return types. The use of NoInfer
seems like a reasonable approach to prevent the outer function's return type from interfering with the updater function's type inference. The added tests provide good coverage for the fix.
Summary of Findings
- Missing
@ts-expect-error
: Inpackages/query-core/src/__tests__/queryClient.test-d.tsx
, the new test case introduced on lines 117-128 does not have an@ts-expect-error
comment, even though the other tests in the file do. This could lead to confusion or accidental removal of the test if someone assumes it should pass without error.
Merge Readiness
The pull request appears to address the reported issue effectively with the use of NoInfer
and includes new test cases to validate the fix. However, there is a missing @ts-expect-error
comment in one of the test files, which should be addressed before merging. I am unable to directly approve this pull request, and other reviewers should also review and approve this code before merging. I recommend that the pull request not be merged until the missing @ts-expect-error
is added.
Applied the
NoInfer
utility type to the return type ofsetQueryData
to prevent the outer function's return type from affecting the updater function's type inference.closes TanStack#9024